package top.putileaf.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import top.putileaf.pojo.Comment;

import java.util.List;
import java.util.Map;

@Mapper
public interface CommentMapper {
    @Insert("insert into comment(article_id,comment_content,create_user,create_time) values(#{articleId},#{commentContent},#{createUser},#{createTime})")
    void add(Comment content);

    @Select("select id,article_id,comment_content,create_user,create_time from comment where article_id=#{articleId} order by create_time desc")
    List<Comment> list(Integer articleId);
}
